<?php
/**
 * Created by IntelliJ IDEA.
 * User: kaireewu
 * Date: 11-10-10
 * Time: 下午6:18
 * To change this template use File | Settings | File Templates.
 */
require_once('inc/common.inc.php');
!defined('IN_SYS') && exit("Access Denied.");
$action = getgpc('action');
$uname = getgpc('username');
$upass = getgpc('password');
$message = '登录成功';
if ($action == 'logout') {
    unLogin();
    $message = '<h2>您已退出登录</h2>';
} else {
    if(empty($uname) || empty($upass)) {
        $message = '<h2>用户名和密码不能为空！</h2>';
    }else{
        if(doLogin($uname, $upass)){
            $message = "<h2>欢迎回来，{$uname}!</h2><p>3秒后将返回首页</p>";
        } else {
            $message = "<h2>用户名或密码错误</h2>";
        }
    }
}
?>
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <meta http-equiv="refresh" content="0; url=<?php echo $sitePath; ?>index.php">
    <title>用户登录</title>
</head>
<body>
<?php echo $message; ?>
</body>
</html>
 
